package com.atguigu.rabitmq.consumer.listener03;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author Taeyang
 * @date 2025/4/7
 */
@Component
public class ConsumerListenerFanout {

    @RabbitListener(queues = "fanout_queue_01")
    public void consumer01(Message message) {
        byte[] body = message.getBody();
        String msg = new String(body);
        System.out.println(Thread.currentThread().getName() + ": ConsumerListener01Fanout -----> " + msg);
    }

    @RabbitListener(queues = "fanout_queue_02")
    public void consumer02(Message message) {
        byte[] body = message.getBody();
        String msg = new String(body);
        System.err.println(Thread.currentThread().getName() + ": ConsumerListener02Fanout -----> " + msg);
    }
}
